<?php 
/**
 * 注册控制器
 * @author 后盾马震宇 <houdunwangmzy@163.com>
 */
class RegisterController extends Controller{
    /**
     * 注册提交
     */
    public function register(){
       if(IS_POST){
       	
       		if(!M()->query("SELECT * FROM hd_user WHERE username='{$_POST['username']}'")&&$_SESSION['code']==strtoupper($_POST['verify'])&&$_POST['pwd']==$_POST['pwded']){
       			$pwd=md5($_POST['pwd']);
				$time=time();
       			M()->exec("INSERT INTO hd_user set username='{$_POST['username']}',passwd='{$pwd}',restime={$time},logintime={$time},loginip='{$_SERVER['REMOTE_ADDR']}'");
				$this->success('注册成功','index.php');
       		}else{
       			$this->error('用户已存在');
       		}
       		
       	       		
       }
    }
	public function code(){
		$code=new Code();
		$code->show();
	}
 }
 
 
 
 
 
 
 
 
 
 
 




 ?>